/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小梅就是酱子
 * Date: 2022-02-04
 * Time: 16:13
 */
public class 求数组中元素的平均值 {
    public static void main(String[] args) {
        int[] array={1,2,3,7,8};
        System.out.println(averageNumber(array));
    }
    public static double averageNumber(int[] array){
        int sum=0;
        for(int i=0;i< array.length;i++){
            sum+=array[i];
        }
        return (double)sum/(double)array.length;
    }
}
